/**
 * Test runner
 */
Root.prototype.hippo_test_action = function() {
   var testRunner = new jala.Test();
   res.debug("Auto: " + getProperty("hippo.testDir"));
   var projectRoot = getProperty("hippo.projectRoot");
   res.debug("Root: " + projectRoot);
   
   var plcResult = checkProjectLayout();
   for(var dir in plcResult) {
      //res.debug("Dir: " + dir + "  -->  " + plcResult[dir]);
   }
   
   plcResult = checkStrictFilenaming();
   for(var dir in plcResult) {
      //res.debug("InnerNaming: " + dir + "  -->  " + plcResult[dir]);
   }
   
   var testDir = new helma.File(getProperty("hippo.testDir"));
   res.debug("FULL: " + testDir.getAbsolutePath());
   var testFiles = testDir.list(/.*\.js$/).sort();
   for(var i = 0; i < testFiles.length; i++) {
      var test = testDir + "/" + testFiles[i];
      testRunner.executeTest(new helma.File(test));
   }
   
   res.debug("Tests run: " + testRunner.testsRun);
   res.debug("Tests run passed: " + testRunner.functionsPassed);
   res.debug("!Tests run: " + testRunner.testsFailed);
   res.debug("!Tests run passed: " + testRunner.functionsFailed);
   
   for (var u = 0; u < testRunner.results.length; u++) {
      var result = testRunner.results[u];   
      for (var i = 0; i < result.log.length; i++) {
         logItem = result.log[i];
         res.debug(logItem);
      }
      
   }
   
   
   return;
};
